package dontCare.gwtester.client.tool;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class TestPanel extends Composite{
	private static TestPanelUiBinder uiBinder = GWT.create(TestPanelUiBinder.class);
	interface TestPanelUiBinder extends UiBinder<Widget, TestPanel> {}

	@UiField SimplePanel container;
	@UiField SimplePanel description;
	@UiField VerticalPanel sourceList;
	
	public TestPanel(UnitWidget unit) {
		initWidget(uiBinder.createAndBindUi(this));
		container.add(unit);
		description.add(unit.getDescription());
		for(String url : unit.getSourceUrl()){
			Anchor a = new Anchor(url.substring(url.lastIndexOf('/')+1), url, "_blank");
			sourceList.add(a);
		}
	}
}